var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(d, c, b) {
    if (status == 0 && d == 0) {
        cm.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            if (cm.getNowTimeString(3).equals(cm.getStringFromQuestInfo(62152, "lastDay"))) {
                cm.sendNormalTalk_Bottom("你今天已经占卜过了，请你明天再来吧。", 37, 9310556, false, false);
                cm.dispose()
            } else {
                cm.askYesNo_Bottom("你是来占卜的吗？价格是1个\r\n#i4310177:##t4310177#，客人。", 37, 9310556)
            }
        } else {
            if (status === a++) {
                if (cm.haveItem(4310177, 1)) {
                    cm.addNumberForQuestInfo(62152, "cnt", 1);
                    cm.setStringForQuestInfo(62152, "lastDay", cm.getNowTimeString(3));
                    cm.gainItem(4310177, -1);
                    cm.dispose();
                    cm.warp(701100015, 3)
                } else {
                    cm.sendNormalTalk_Bottom("客人，如果没钱，我是不能为你占卜的。请带钱来。", 37, 9310556, false, false);
                    cm.dispose()
                }
            } else {
                cm.dispose()
            }
        }
    }
};